<template>
  <div class="homeblog">
    <h2>推荐文章</h2>
    <br />
    <div class="box" v-for="(item, index) in lists.blogs" :key="index">
        <h1>{{ item.title }}</h1>
        <router-link :to="lists.url + '/' + item.id">{{lists.category}}</router-link>
    </div>
  </div>
</template>

<script>
export default {
  computed: {
    lists() {
     return this.$store.state.hotblogs;
    }
  },
  // data() {
  //   return {
  //     lists: this.$store.state.hotblogs,
  //   };
  // },
  created() {
    console.log(this.lists);
  },
};
</script>

<style lang="scss" scoped>
.homeblog {
  padding: 20px;
}
.box {
  height: 150px;
  width: 100%;
  background-color: #888;
  text-align: center;
  line-height: 150px;
  border-radius: 5px;
  color: #555;
  position: relative;
  margin-top: 20px;
  a {
    display: block;
    height: 30px;
    width: 100px;
    line-height: 30px;
    border-radius: 5px;
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: #fff;
    background-color: #555;
  }
}
</style>